package com.zz.utils;


import lombok.experimental.UtilityClass;

@UtilityClass
public class TransferUtil {

    // 转换实名认证方式
    public String transferTrueName(String data){
        return data.replaceAll("个人银行卡四要素认证","PSN_BANK4_AUTHCODE")
                .replaceAll("个人运营商三要素认证","PSN_TELECOM_AUTHCODE")
                .replaceAll("个人刷脸认证","PSN_FACEAUTH_BYURL");
    }

    // 转换意愿认证
    public String transferWill(String data){
        return data.replaceAll("短信验证码","CODE_SMS")
                .replaceAll("支付宝刷脸","FACE_ZHIMA_XY")
                .replaceAll("腾讯云刷脸","FACE_TECENT_CLOUD_H5");
    }

    // 实名认证方式
    public String transferTrueNameString( String[] psn){
        StringBuilder updateType = new StringBuilder();
        for (String type : psn) {
            if (type.equalsIgnoreCase("PSN_BANK4_AUTHCODE")) {
                updateType.append("个人银行卡四要素认证,");
            } else if (type.equalsIgnoreCase("PSN_TELECOM_AUTHCODE")) {
                updateType.append("个人运营商三要素认证,");
            } else if (type.equalsIgnoreCase("PSN_FACEAUTH_BYURL")) {
                updateType.append("个人刷脸认证,");
            }
        }
       return updateType.deleteCharAt(updateType.length() - 1).toString();
    }

    // 实名认证方式
    public String transferTrueNameCode( String[] psn){
        StringBuilder updateType = new StringBuilder();
        for (String type : psn) {
            if (type.equalsIgnoreCase("个人银行卡四要素认证")) {
                updateType.append("PSN_BANK4_AUTHCODE,");
            } else if (type.equalsIgnoreCase("个人运营商三要素认证")) {
                updateType.append("PSN_TELECOM_AUTHCODE,");
            } else if (type.equalsIgnoreCase("个人刷脸认证")) {
                updateType.append("PSN_FACEAUTH_BYURL,");
            }
        }
        return updateType.deleteCharAt(updateType.length() - 1).toString();
    }

    // 意愿认证
    public String transferWillString( String[] wts){
        StringBuilder willType = new StringBuilder();
        for (String type : wts) {
            if (type.equalsIgnoreCase("CODE_SMS")) {
                willType.append("短信验证码,");
            } else if (type.equalsIgnoreCase("FACE_ZHIMA_XY")) {
                willType.append("支付宝刷脸,");
            } else if (type.equalsIgnoreCase("FACE_TECENT_CLOUD_H5")) {
                willType.append("腾讯云刷脸,");
            }
        }
       return willType.deleteCharAt(willType.length() - 1).toString();
    }


    // 意愿认证
    public String transferWillCode( String[] wts){
        StringBuilder willType = new StringBuilder();
        for (String type : wts) {
            if (type.equalsIgnoreCase("短信验证码")) {
                willType.append("CODE_SMS,");
            } else if (type.equalsIgnoreCase("支付宝刷脸")) {
                willType.append("FACE_ZHIMA_XY,");
            } else if (type.equalsIgnoreCase("腾讯云刷脸")) {
                willType.append("FACE_TECENT_CLOUD_H5,");
            }
        }
        return willType.deleteCharAt(willType.length() - 1).toString();
    }
}
